<template>
	<div style="width:100%">
		<div id="maindl" style="min-width: 100%;height:280px;"></div>
		
	</div>
</template>

<script>
	import * as echarts from 'echarts';
	export default {
		name:"tubiaof",
		props: ['jieyueliangmsg'],
		  data(){
			  return{
			  	tongjimsg:{},
				datelist:[],
				jielist:[],
				huanlist:[],
			  }
		  },
		  watch:{
			  jieyueliangmsg(oldval,newval){
				  this.getmsg()
			  }
		  },
		  created () {
			
		  },
		  mounted(){
			this.getmsg()
		  },
		  methods:{
			  async getmsg(){
				  this.tongjimsg=this.jieyueliangmsg
				  this.datelist=[]
				  this.jielist=[]
				  this.huanlist=[]
				  for(let item of this.tongjimsg){
					  this.datelist.push(item.name)
					   this.jielist.push(item.jie_num) // 敏感
					   this.huanlist.push(item.huan_num) // 非敏感
				  }
				  console.log( '你好',this.datelist)
				  // this.jiemsg=this.jieyuemsg
				  let that =this
					  setTimeout(res=>{
						  that.getbiao()
					  },500)
					 
				  
				  
			  },
			  getbiao(){
				let a = this.datelist
				let b = this.jielist
				let c = this.huanlist
				
				// let b=this.jiemsg.borrow_zhanbi
				
				  // console.log('这是a',b)
				var myChart = echarts.init(document.getElementById('maindl'));
				
				let   option = {
    legend: {
		icon: "rect"
	},
    tooltip: {
      trigger: 'axis',
      showContent: false
    },
    dataset: {
      source: [
        ['product', '2023-6-17', '2023-6-18', '2023-6-19', '2023-6-20', '2023-6-21', '2023-6-22','2023-6-23','2023-6-24'],
        ['正面', 56.5, 82.1, 88.7, 70.1, 53.4, 85.1,56.5,60.3],
        ['负面', 51.1, 51.4, 55.1, 53.3, 73.8, 68.7,53.3, 73.8],
        ['中立', 40.1, 62.2, 69.5, 36.4, 45.2, 32.5,40.1, 62.2],
      ]
    },

    xAxis: { type: 'category' },
    yAxis: { gridIndex: 0,
					name: '舆情量/篇',
		},
    series: [
      {
        type: 'line',
        smooth: true,
        seriesLayoutBy: 'row',
        emphasis: { focus: 'series' }
      },
      {
        type: 'line',
        smooth: true,
        seriesLayoutBy: 'row',
        emphasis: { focus: 'series' }
      },
      {
        type: 'line',
        smooth: true,
        seriesLayoutBy: 'row',
        emphasis: { focus: 'series' }
      },

    ]
  };
				        // 使用刚指定的配置项和数据显示图表。
				        myChart.setOption(option);
			  }
		  },
		
	}
</script>

<style>
</style>